<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  <title>LCOV - mbi.info - smart_ptr/scoped_array.hpp</title>
  <link rel="stylesheet" type="text/css" href="../gcov.css">
</head>

<body>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="title">LTP GCOV extension - code coverage report</td></tr>
    <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>

    <tr>
      <td width="100%">
        <table cellpadding=1 border=0 width="100%">
        <tr>
          <td class="headerItem" width="20%">Current&nbsp;view:</td>
          <td class="headerValue" width="80%" colspan=4><a href="../index.html">directory</a> - <a href="index.html">smart_ptr</a> - scoped_array.hpp</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Test:</td>
          <td class="headerValue" width="80%" colspan=4>mbi.info</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Date:</td>
          <td class="headerValue" width="20%">2010-01-23</td>
          <td width="20%"></td>
          <td class="headerItem" width="20%">Instrumented&nbsp;lines:</td>
          <td class="headerValue" width="20%">16</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Code&nbsp;covered:</td>
          <td class="headerValue" width="20%">100.0 %</td>
          <td width="20%"></td>
          <td class="headerItem" width="20%">Executed&nbsp;lines:</td>
          <td class="headerValue" width="20%">16</td>
        </tr>
        </table>
      </td>
    </tr>
    <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
  </table>

  <table cellpadding=0 cellspacing=0 border=0>
    <tr>
      <td><br></td>
    </tr>
    <tr>
      <td><pre class="source">
<span class="lineNum">       1 </span>                : #ifndef BOOST_SMART_PTR_SCOPED_ARRAY_HPP_INCLUDED
<span class="lineNum">       2 </span>                : #define BOOST_SMART_PTR_SCOPED_ARRAY_HPP_INCLUDED
<span class="lineNum">       3 </span>                : 
<span class="lineNum">       4 </span>                : //  (C) Copyright Greg Colvin and Beman Dawes 1998, 1999.
<span class="lineNum">       5 </span>                : //  Copyright (c) 2001, 2002 Peter Dimov
<span class="lineNum">       6 </span>                : //
<span class="lineNum">       7 </span>                : //  Distributed under the Boost Software License, Version 1.0. (See
<span class="lineNum">       8 </span>                : //  accompanying file LICENSE_1_0.txt or copy at
<span class="lineNum">       9 </span>                : //  http://www.boost.org/LICENSE_1_0.txt)
<span class="lineNum">      10 </span>                : //
<span class="lineNum">      11 </span>                : //  http://www.boost.org/libs/smart_ptr/scoped_array.htm
<span class="lineNum">      12 </span>                : //
<span class="lineNum">      13 </span>                : 
<span class="lineNum">      14 </span>                : #include &lt;boost/assert.hpp&gt;
<span class="lineNum">      15 </span>                : #include &lt;boost/checked_delete.hpp&gt;
<span class="lineNum">      16 </span>                : #include &lt;boost/config.hpp&gt;   // in case ptrdiff_t not in std
<span class="lineNum">      17 </span>                : 
<span class="lineNum">      18 </span>                : #include &lt;boost/detail/workaround.hpp&gt;
<span class="lineNum">      19 </span>                : 
<span class="lineNum">      20 </span>                : #include &lt;cstddef&gt;            // for std::ptrdiff_t
<span class="lineNum">      21 </span>                : 
<span class="lineNum">      22 </span>                : namespace boost
<span class="lineNum">      23 </span>                : {
<span class="lineNum">      24 </span>                : 
<span class="lineNum">      25 </span>                : // Debug hooks
<span class="lineNum">      26 </span>                : 
<span class="lineNum">      27 </span>                : #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
<span class="lineNum">      28 </span>                : 
<span class="lineNum">      29 </span>                : void sp_array_constructor_hook(void * p);
<span class="lineNum">      30 </span>                : void sp_array_destructor_hook(void * p);
<span class="lineNum">      31 </span>                : 
<span class="lineNum">      32 </span>                : #endif
<span class="lineNum">      33 </span>                : 
<span class="lineNum">      34 </span>                : //  scoped_array extends scoped_ptr to arrays. Deletion of the array pointed to
<span class="lineNum">      35 </span>                : //  is guaranteed, either on destruction of the scoped_array or via an explicit
<span class="lineNum">      36 </span>                : //  reset(). Use shared_array or std::vector if your needs are more complex.
<span class="lineNum">      37 </span>                : 
<span class="lineNum">      38 </span>                : template&lt;class T&gt; class scoped_array // noncopyable
<span class="lineNum">      39 </span>                : {
<span class="lineNum">      40 </span>                : private:
<span class="lineNum">      41 </span>                : 
<span class="lineNum">      42 </span>                :     T * px;
<span class="lineNum">      43 </span>                : 
<span class="lineNum">      44 </span>                :     scoped_array(scoped_array const &amp;);
<span class="lineNum">      45 </span>                :     scoped_array &amp; operator=(scoped_array const &amp;);
<span class="lineNum">      46 </span>                : 
<span class="lineNum">      47 </span>                :     typedef scoped_array&lt;T&gt; this_type;
<span class="lineNum">      48 </span>                : 
<span class="lineNum">      49 </span>                :     void operator==( scoped_array const&amp; ) const;
<span class="lineNum">      50 </span>                :     void operator!=( scoped_array const&amp; ) const;
<span class="lineNum">      51 </span>                : 
<span class="lineNum">      52 </span>                : public:
<span class="lineNum">      53 </span>                : 
<span class="lineNum">      54 </span>                :     typedef T element_type;
<span class="lineNum">      55 </span>                : 
<span class="lineNum">      56 </span><span class="lineCov">             14 :     explicit scoped_array( T * p = 0 ) : px( p ) // never throws</span>
<span class="lineNum">      57 </span>                :     {
<span class="lineNum">      58 </span>                : #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
<span class="lineNum">      59 </span>                :         boost::sp_array_constructor_hook( px );
<span class="lineNum">      60 </span>                : #endif
<span class="lineNum">      61 </span><span class="lineCov">             14 :     }</span>
<span class="lineNum">      62 </span>                : 
<span class="lineNum">      63 </span><span class="lineCov">             14 :     ~scoped_array() // never throws</span>
<span class="lineNum">      64 </span>                :     {
<span class="lineNum">      65 </span>                : #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
<span class="lineNum">      66 </span>                :         boost::sp_array_destructor_hook( px );
<span class="lineNum">      67 </span>                : #endif
<span class="lineNum">      68 </span><span class="lineCov">             14 :         boost::checked_array_delete( px );</span>
<span class="lineNum">      69 </span><span class="lineCov">             14 :     }</span>
<span class="lineNum">      70 </span>                : 
<span class="lineNum">      71 </span><span class="lineCov">              8 :     void reset(T * p = 0) // never throws</span>
<span class="lineNum">      72 </span>                :     {
<span class="lineNum">      73 </span><span class="lineCov">              8 :         BOOST_ASSERT( p == 0 || p != px ); // catch self-reset errors</span>
<span class="lineNum">      74 </span><span class="lineCov">              8 :         this_type(p).swap(*this);</span>
<span class="lineNum">      75 </span><span class="lineCov">              8 :     }</span>
<span class="lineNum">      76 </span>                : 
<span class="lineNum">      77 </span>                :     T &amp; operator[](std::ptrdiff_t i) const // never throws
<span class="lineNum">      78 </span>                :     {
<span class="lineNum">      79 </span>                :         BOOST_ASSERT( px != 0 );
<span class="lineNum">      80 </span>                :         BOOST_ASSERT( i &gt;= 0 );
<span class="lineNum">      81 </span>                :         return px[i];
<span class="lineNum">      82 </span>                :     }
<span class="lineNum">      83 </span>                : 
<span class="lineNum">      84 </span><span class="lineCov">             13 :     T * get() const // never throws</span>
<span class="lineNum">      85 </span>                :     {
<span class="lineNum">      86 </span><span class="lineCov">             13 :         return px;</span>
<span class="lineNum">      87 </span>                :     }
<span class="lineNum">      88 </span>                : 
<span class="lineNum">      89 </span>                : // implicit conversion to &quot;bool&quot;
<span class="lineNum">      90 </span>                : #include &lt;boost/smart_ptr/detail/operator_bool.hpp&gt;
<span class="lineNum">      91 </span>                : 
<span class="lineNum">      92 </span><span class="lineCov">              8 :     void swap(scoped_array &amp; b) // never throws</span>
<span class="lineNum">      93 </span>                :     {
<span class="lineNum">      94 </span><span class="lineCov">              8 :         T * tmp = b.px;</span>
<span class="lineNum">      95 </span><span class="lineCov">              8 :         b.px = px;</span>
<span class="lineNum">      96 </span><span class="lineCov">              8 :         px = tmp;</span>
<span class="lineNum">      97 </span><span class="lineCov">              8 :     }</span>
<span class="lineNum">      98 </span>                : };
<span class="lineNum">      99 </span>                : 
<span class="lineNum">     100 </span>                : template&lt;class T&gt; inline void swap(scoped_array&lt;T&gt; &amp; a, scoped_array&lt;T&gt; &amp; b) // never throws
<span class="lineNum">     101 </span>                : {
<span class="lineNum">     102 </span>                :     a.swap(b);
<span class="lineNum">     103 </span>                : }
<span class="lineNum">     104 </span>                : 
<span class="lineNum">     105 </span>                : } // namespace boost
<span class="lineNum">     106 </span>                : 
<span class="lineNum">     107 </span>                : #endif  // #ifndef BOOST_SMART_PTR_SCOPED_ARRAY_HPP_INCLUDED
</pre>
      </td>
    </tr>
  </table>
  <br>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
  <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
  <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LTP GCOV extension version 1.6</a></td></tr>
  </table>
  <br>

</body>
</html>
